﻿using System;
using System.Configuration;
using System.Net.Configuration;

namespace TeamFranceTriple.Config
{
    public static class TeamFranceTripleConfig
    {
        public static TeamFranceTripleAppConfig WebConfig = (TeamFranceTripleAppConfig)ConfigurationManager.GetSection("teamfrancetripleconfig/teamfrancetriplesectionconfig");
        public static SmtpSection Smtp = (SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp");
    }
    public class TeamFranceTripleAppConfig : ConfigurationSection
    {
        public TeamFranceTripleAppConfig() { }

        [ConfigurationProperty("DefaultPage", IsRequired = false)]
        public String DefaultPage
        {
            get { return (String)this["DefaultPage"]; }
            set { this["DefaultPage"] = value; }
        }

        [ConfigurationProperty("mailerror")]
        public mailerror mailerror
        {
            get { return (mailerror)this["mailerror"]; }
            set { this["mailerror"] = value; }
        }

        [ConfigurationProperty("defaultculturewhenacceptcultureisnull")]
        public defaultculturewhenacceptcultureisnull defaultculturewhenacceptcultureisnull
        {
            get { return (defaultculturewhenacceptcultureisnull)this["defaultculturewhenacceptcultureisnull"]; }
            set { this["defaultculturewhenacceptcultureisnull"] = value; }
        }
        [ConfigurationProperty("shoutbox")]
        public shoutbox shoutbox
        {
            get { return (shoutbox)this["shoutbox"]; }
            set { this["shoutbox"] = value; }
        }
        [ConfigurationProperty("LastUserVisit")]
        public LastUserVisit LastUserVisit
        {
            get { return (LastUserVisit)this["LastUserVisit"]; }
            set { this["LastUserVisit"] = value; }
        }

        [ConfigurationProperty("NextUserBirthday")]
        public NextUserBirthday NextUserBirthday
        {
            get { return (NextUserBirthday)this["NextUserBirthday"]; }
            set { this["NextUserBirthday"] = value; }
        }

        [ConfigurationProperty("ForumConfig")]
        public ForumConfig ForumConfig
        {
            get { return (ForumConfig)this["ForumConfig"]; }
            set { this["ForumConfig"] = value; }
        }
    }

    public class mailerror : ConfigurationElement
    {
        public mailerror() { }

        public mailerror(String from, String to)
        {
            this.from = from;
            this.to = to;
        }

        [ConfigurationProperty("from", IsRequired = false)]
        public String from
        {
            get { return (String)this["from"]; }
            set { this["from"] = value; }
        }

        [ConfigurationProperty("to", IsRequired = false)]
        public String to
        {
            get { return (String)this["to"]; }
            set { this["to"] = value; }
        }
        [ConfigurationProperty("enable", IsRequired = false)]
        public Boolean enable
        {
            get { return (Boolean)this["enable"]; }
            set { this["enable"] = value; }
        }
    }
    public class defaultculturewhenacceptcultureisnull : ConfigurationElement
    {
        public defaultculturewhenacceptcultureisnull() { }

        [ConfigurationProperty("culture", IsRequired = false)]
        public String culture
        {
            get { return (String)this["culture"]; }
            set { this["culture"] = value; }
        }
    }
    public class shoutbox : ConfigurationElement
    {
        public shoutbox() { }

        [ConfigurationProperty("MaxNumberOfMessage", IsRequired = false)]
        public Int32 MaxNumberOfMessage
        {
            get { return (Int32)this["MaxNumberOfMessage"]; }
            set { this["MaxNumberOfMessage"] = value; }
        }
        [ConfigurationProperty("AutoRefresh", IsRequired = false)]
        public Int32 AutoRefresh
        {
            get { return (Int32)this["AutoRefresh"]; }
            set { this["AutoRefresh"] = value; }
        }
    }
    public class LastUserVisit : ConfigurationElement
    {
        public LastUserVisit() { }

        [ConfigurationProperty("MaxNumberOfUser", IsRequired = false)]
        public Int32 MaxNumberOfUser
        {
            get { return (Int32)this["MaxNumberOfUser"]; }
            set { this["MaxNumberOfUser"] = value; }
        }
        [ConfigurationProperty("AutoRefresh", IsRequired = false)]
        public Int32 AutoRefresh
        {
            get { return (Int32)this["AutoRefresh"]; }
            set { this["AutoRefresh"] = value; }
        }
    }

    public class NextUserBirthday : ConfigurationElement
    {
        public NextUserBirthday() { }

        [ConfigurationProperty("MaxNumberOfUser", IsRequired = false)]
        public Int32 MaxNumberOfUser
        {
            get { return (Int32)this["MaxNumberOfUser"]; }
            set { this["MaxNumberOfUser"] = value; }
        }
        [ConfigurationProperty("AutoRefresh", IsRequired = false)]
        public Int32 AutoRefresh
        {
            get { return (Int32)this["AutoRefresh"]; }
            set { this["AutoRefresh"] = value; }
        }
    }

    public class ForumConfig : ConfigurationElement
    {
        public ForumConfig() { }

        [ConfigurationProperty("TopicPageSize", IsRequired = false)]
        public Int32 TopicPageSize
        {
            get { return (Int32)this["TopicPageSize"]; }
            set { this["TopicPageSize"] = value; }
        }

        [ConfigurationProperty("PostPageSize", IsRequired = false)]
        public Int32 PostPageSize
        {
            get { return (Int32)this["PostPageSize"]; }
            set { this["PostPageSize"] = value; }
        }
    }
}
